//tbClass.controller.ts


import { Inject, Controller, Get, Query, Post, Body, App, All } from "@midwayjs/core";
import { Context } from "@midwayjs/koa";
import { HttpService } from "@midwayjs/axios";
import { Application } from "../interface.js";
import { failres, okres } from "../config/resUtil.js";
import { InjectEntityModel } from "@midwayjs/typeorm";
import { Repository } from "typeorm";
import {  tbClassEntity  } from "../entity/tbClass.entity.js";
import { BaseDto } from "../models/Base.dto.js";
import { getSkip } from "../utils/pageUtil.js";
import { TbclassService } from "../service/tbClass.Service.js";


@Controller('/api/tb_class')
export class  tbClassController{
  @Inject()
  ctx: Context;
  @App("koa")
  app: Application;

  @Inject()
  tbClassService: TbclassService;

  //find
  @Post("/getlist")
  async getlist(@Body() body: tbClassEntity & BaseDto) {
    var result3 = await this.tbClassService.getlist(body);
    return okres(result3);
  }
  //findone
  @Get("/getbyid")
  async getbyid(@Query('id') id) {
    var result3 = await this.tbClassService.getbyid(id);
    return okres(result3);
  }
  //add
  @Post("/add")
  async add(@Body() body: tbClassEntity & BaseDto) {
    var result3 = await this.tbClassService.add(body);
    return okres(result3);
  }
  //update
  @Post("/update")
  async update(@Body() body: tbClassEntity & BaseDto) {
    var result3 = await this.tbClassService.update(body);
    return okres(result3);
  }
  //delbyid
  @Get("/delbyid")
  async delbyid(@Query('id') id) {
    var result3 = await this.tbClassService.delbyid(id);
    return okres(result3);
  }


}
